procedure breakcube(nome, start, final, step)
char    nome         {prompt="BBase name for files "}
int     start        {1,min=1,max=4096,prompt="Number of vertical mask positions"}
int     final          {512,min=1,max=4096,prompt="Number of horizontal mask positions"}
int     step          {1,prompt="Filetype of images"}
struct  *lista

begin

int i,j 
int n_start,n_final,n_step

# iraf doesn't like we use the parameter variables within the script
# so here we make a copy of them to a new variable 
# whose name has an n added to the beginning of the name of each of them
# 
char n_nome, n_ext
n_start = start
n_final   = final
n_step  = step
n_nome = nome

n_start = 1
print n_start,n_final,n_step
j = 0 
for (i=n_start ; i<n_final ; i+=n_step) {
   ldisplay(input=n_nome,output=n_nome//str(j),w1=i,w2=i+n_step-1)
   j = j + 1
   }

end
